Skip to content

USHIFT-6765: Add automatic restart and approval options to Claud prow-PR script#6428

Merged
openshift-merge-bot[bot] merged 4 commits into
openshift:mainfrom
ggiguash:analyze-ci-pr-approval
Mar 30, 2026
Merged

USHIFT-6765: Add automatic restart and approval options to Claud prow-PR script#6428
openshift-merge-bot[bot] merged 4 commits into
openshift:mainfrom
ggiguash:analyze-ci-pr-approval

Conversation

@ggiguash

@ggiguash ggiguash commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Scope

  • Approve PRs only if all the tests finished successfully
  • Restart failed jobs only

Testing

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 30, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 30, 2026
@openshift-ci

openshift-ci Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci-robot

openshift-ci-robot commented Mar 30, 2026

Copy link
Copy Markdown

@ggiguash: This pull request references USHIFT-6765 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

  • Approvel PRs only if all the tests finished successfully
  • Restart failed jobs only

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 5454f6e4-cae7-439a-85fd-3419b83ad395

📥 Commits

Reviewing files that changed from the base of the PR and between de33f09 and f01bd79.

📒 Files selected for processing (1)
  • .claude/scripts/microshift-prow-jobs-for-pull-requests.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • .claude/scripts/microshift-prow-jobs-for-pull-requests.sh

Walkthrough

Adds two new CLI modes to the Prow job management script: approve posts approval comments when all discovered jobs are SUCCESS; restart posts /test … rerun commands for jobs with result FAILURE. fetch_pr_results() now fails when job discovery or any job-result fetch fails, and PRs with incomplete results are skipped.

Changes

Cohort / File(s) Summary
Prow jobs PR utility
.claude/scripts/microshift-prow-jobs-for-pull-requests.sh
Added mode_approve() and mode_restart() modes and updated usage(); fetch_pr_results() now signals non-zero and writes a .fetch_failed marker when job listing or any job result fetch fails; control flow updated to skip PRs with incomplete results; mode_approve posts /lgtm and /verified by ci only when all discovered jobs are SUCCESS; mode_restart gathers jobs with result FAILURE, reads each failed job's prowjob.json from GCS to extract rerun commands, and posts one /test … line per failed job.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 30, 2026
@openshift-ci-robot

openshift-ci-robot commented Mar 30, 2026

Copy link
Copy Markdown

@ggiguash: This pull request references USHIFT-6765 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Scope

  • Approvel PRs only if all the tests finished successfully
  • Restart failed jobs only

Testing

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@ggiguash ggiguash changed the title USHIFT-6765: Add automatic restart and approval options to prow PR script USHIFT-6765: Add automatic restart and approval options to Claud prow-PR script Mar 30, 2026
@ggiguash

Copy link
Copy Markdown
Contributor Author

@coderabbitai perform full review

@coderabbitai

coderabbitai Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

@ggiguash: On it! Performing a full review of the PR now.

✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/scripts/microshift-prow-jobs-for-pull-requests.sh:
- Around line 291-301: The script appends "/test ${short_name}" to the comment
even when short_name is empty, creating malformed commands; update the loop that
builds comment (the block using short_name and comment variables where
short_name is populated from jq and sed) to skip adding a `/test` line when
short_name is empty or only whitespace (e.g., check short_name after trimming
and only append when non-empty), leaving the existing trailing-newline removal
and gh pr comment call unchanged.
- Around line 216-238: The approval logic currently trusts whatever result files
exist in tmpdir, allowing undercounting when fetches fail; update the flow so
fetch_pr_results communicates failures (e.g., return non-zero or write a failure
marker) and the caller checks that before counting results: call
fetch_pr_results "${pr_number}" "${tmpdir}" and if it exits non-zero or a
fetch-failed marker exists, log "PR #${pr_number}: incomplete job results,
skipping" and continue instead of computing total/success; ensure the variables
and checks around tmpdir, total, success, and the loop that reads files are only
executed when fetch_pr_results succeeded.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 1a04f11e-884a-482c-88f8-2166e4619f81

📥 Commits

Reviewing files that changed from the base of the PR and between bad0cfb and de33f09.

📒 Files selected for processing (1)
  • .claude/scripts/microshift-prow-jobs-for-pull-requests.sh

Comment thread .claude/scripts/microshift-prow-jobs-for-pull-requests.sh Outdated
Comment thread .claude/scripts/microshift-prow-jobs-for-pull-requests.sh
@openshift-ci-robot

openshift-ci-robot commented Mar 30, 2026

Copy link
Copy Markdown

@ggiguash: This pull request references USHIFT-6765 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Scope

  • Approve PRs only if all the tests finished successfully
  • Restart failed jobs only

Testing

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot

openshift-ci-robot commented Mar 30, 2026

Copy link
Copy Markdown

@ggiguash: This pull request references USHIFT-6765 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Scope

  • Approve PRs only if all the tests finished successfully
  • Restart failed jobs only

Testing

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@ggiguash ggiguash marked this pull request as ready for review March 30, 2026 06:51
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 30, 2026
@openshift-ci openshift-ci Bot requested review from agullon and kasturinarra March 30, 2026 06:51
@ggiguash

Copy link
Copy Markdown
Contributor Author

/verified by @ggiguash

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 30, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@ggiguash: This PR has been marked as verified by @ggiguash.

Details

In response to this:

/verified by @ggiguash

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

@ggiguash: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@eslutsky

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Mar 30, 2026
@openshift-ci

openshift-ci Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: eslutsky, ggiguash

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot Bot merged commit 67116d2 into openshift:main Mar 30, 2026
7 checks passed
@ggiguash ggiguash deleted the analyze-ci-pr-approval branch March 30, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants